{extend name="base" /}
{block name="body"}
<div class="layui-container">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md8">

      <div class="fly-panel">
 
    <div class="layui-card-body">
        <form action="{:request()->url()}" class="layui-form" method="post">
         <h3>重在参与，文明投稿</h3><hr class="layui-border-red">
            
             <div class="layui-form-item">
                   <label class="layui-form-label">头像图片</label>
                 <div class="layui-input-inline">
                        <div class="profile-avatar-container">
                  <img id="image" class="profile-user-img img-responsive" src="/static/libs/images/no_image.jpg" alt="">
            <span class="layui-upload-list">
                   <div class="profile-avatar-text">{:__('Click Edit')}</div>
               <button type="button" id="ajax-admin-avatar"><i class="fa fa-upload"></i>{:__('Edit')}</button>
            </span>
            <span class="layui-upload-list" style="padding-left: 20px;"></span>
                       </div>
                   </div>
            <input type="hidden" name="filesize" id="filesize" value="">
            <input type="hidden" name="mine" id="mine" value="">
            <input type="hidden" name="image" value="">
           </div>
           
   
        <div class="layui-form-item">
            <label class="layui-form-label">{:__('Column')}</label>
            <div class="layui-input-inline" style="width:170px;">
                <select class="layui-input" name="cat_id" id="cat_id" style="width: 95%" lay-verify="required" lay-search="">
                    <option value="0">无</option>
                   {foreach $name as $vo} 
                    
                    <option value="{$vo.id}" {if condition="isset($list.cat_id) and $list.cat_id == $vo.id"}Selected="Selected"{/if}>{$vo.name}</option>
                                  
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">{:__('title')}</label>
            <div class="layui-input-inline">

                <input type="text" name="title" id="title" value="{$list.title|default=''}" lay-verify="required" placeholder="标题" autocomplete="off" class="layui-input">
            </div>
        </div>


         <div class="layui-form-item">
                <label class="layui-form-label">{:__('content')}</label>
                <div class="layui-input-inline">
                   
                    <textarea id="content" name="content" class="layui-textarea" placeholder="请输入内容" style= "overflow:hidden;">{$list.content|default=''}</textarea>
                </div>
            </div>
        <div class="layui-form-item">
            <label class="layui-form-label">{:__('sign')}</label>
            <div class="layui-input-inline">
               
                <select class="layui-input" name="flag" id="flag" lay-verify="required" lay-search="">    
                    <option value="0">{:__('Please select')}</option>                  
                <option value="1" {if isset($list.flag) and $list.flag == '1'}selected{/if} title="{:__('newest')}" class="layui-input">{:__('newest')}</option>
                <option value="2" {if isset($list.flag) and $list.flag == '2'}selected{/if} title="{:__('Hot')}" class="layui-input">{:__('Hot')}</option>
                <option value="3" {if isset($list.flag) and $list.flag == '3'}selected{/if} title="{:__('recommend')}" class="layui-input">{:__('recommend')}</option>
                </select>
            </div>

            </div>    
        <div class="layui-form-item">
            <label class="layui-form-label">{:__('sort')}</label>
            <div class="layui-input-inline"> 
                <input type="radio" name="weigh" value="1" title="{:__('Top')}" class="layui-input">
                <input type="radio" name="weigh" value="0" title="{:__('normal')}" class="layui-input" checked>
            
            </div>
        </div>
            <div class="layui-form-item">  
             <div class="layui-input-block">

                    <button class="layui-btn layui-btn-sm" lay-filter="save" lay-submit="">保存</button>
                     <button type="reset" class="layui-btn-sm layui-btn layui-btn-danger" onclick="clean()">{:__('Refill')}</button>
                </div>
            </div>
        </form>
    </div>
      </div>
    </div>
    <div class="layui-col-md4">


      <dl class="fly-panel fly-list-one">
        <dt class="fly-panel-title"><h2>今日随机推荐阅读</h2></dt>
    {foreach $model['data'] as $vo}
                <dd>
          <a href="{:url('detail/index?Art=' . base64_encode($vo['id']) . '&ZcT=' . base64_encode($vo['cat_id']) . '')}">{$vo.title}</a>
          <span><i class="iconfont" title="人气"></i>{$vo.view}</span>
        </dd>
         {/foreach}
                <!-- 无数据时 -->
        <!--
        <div class="fly-none">没有相关数据</div>
        -->
      </dl>

      <div class="fly-panel">
        <div class="fly-panel-title">
          广告位出租
        </div>
        <div class="fly-panel-main">
          <a href="https://ztuc.cn/" target="_blank" class="fly-zanzhu" time-limit="2017.09.25-2099.01.01" style="background-color: #5FB878;">WY线报第一分享网云梦社区</a>
        </div>
      </div>
      
      <div class="fly-panel fly-link">
        <h3 class="fly-panel-title">友情链接</h3>
        <dl class="fly-panel-main">
                  <dd><a href="http://wap.ztuc.cn/" target="_blank">折腾社区</a></dd>
                  <dd></dd>
                  <dd><a href="http://ztuc.cn/" target="_blank">云梦社区</a></dd>
                  <dd></dd>
                   <dd><a href="http://nokc.cn/" target="_blank">两性之家</a></dd>
                  <dd></dd>
                  <dd><a href="mailto:8142355@qq.com?subject=%E7%94%B3%E8%AF%B7Fly%E7%A4%BE%E5%8C%BA%E5%8F%8B%E9%93%BE" class="fly-link">申请友链</a></dd>
                  <dd></dd>
              </dl>
      </div>
 
    </div>
  </div>
</div>

   {/block}      
{block name="js"}
<script>
layui.use(['upload', 'element', 'table', 'form', 'layer', 'jquery'], function () {
            // Tab的切换功能，切换事件监听等，需要依赖element模块
            var $ = layui.jquery, table = layui.table, element = layui.element;

            var upload = layui.upload;
             form = layui.form;
             $    = layui.jquery;        
             form.render();
   //普通图片上传
      var uploadInst = upload.render({
    elem: '#ajax-admin-avatar',
            exts: 'jpg|png|jpeg|gif|svg',
            size: 2048,
    url: "{:url('upload/uploadImage',['model'=>'4'])}", //Change to your own upload interface //改成您自己的上传接口
    done: function (result) {
        // 上传完毕回调
        if (result.code === 1) {
            $('#image').attr('src', result.url);
            //this.item.prev('input').val(result.url);
            $('input[name="image"]').val(result.url);
            $('input[name="filesize"]').val(result.filesize);
            $('input[name="mine"]').val(result.mine);
            layer.msg('上传成功', {icon: 1});
        } else {
            layer.msg(result.msg, {icon: 2});
        }
    }
        });
      //重新输入
   function clean(){
     $("content").val("");
}
        
});
</script>
{include file="common/footer" /}
{/block}   